import { defineStore } from 'pinia'
import { ref } from 'vue'
import type { LoginUser } from '@/types/user'
export const useLoginStore = defineStore(
  'login',
  () => {
    // 定义数据
    const loginUser = ref<LoginUser>()
    // 更新登录后用户数据
    const updataLogin = (data: LoginUser): void => {
      loginUser.value = data
    }
    // 删除登录后用户数据
    const delLoginUser = (): void => {
      loginUser.value = undefined
    }
    return { loginUser, updataLogin, delLoginUser }
  },
  {
    persist: true
  }
)
